var exchange = function (nums) {
  let arr1 = nums.filter((item) => {
    return item % 2 == 0;
  });
  let arr2 = nums.filter((item) => {
    return item % 2 == 1;
  });
  console.log(arr1, arr2);

  let arr3 = arr2.concat(arr1);
  return arr3;
};

let nums = [0, 1, 2, 3, 4, 0];
console.log(exchange(nums));
